package com.sloan.community.exception;

import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
public class CommunityException extends RuntimeException {

    private HttpStatus status;

    private String message;

    private CommunityException(String message) {
        super(message);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.message = message;
    }

    private CommunityException(HttpStatus status, String message) {
        super(message);
        this.status = status;
        this.message = message;
    }

    public static CommunityException of(String msg) {
        return new CommunityException(msg);
    }

    public static CommunityException of(HttpStatus status, String msg) {
        return new CommunityException(status, msg);
    }
}
